/*
 * AbstractKeyboard.h
 *
 *  Created on: 11 mars 2011
 *      Author: seeme
 *      Une simple classe container qui encapsule l'état des touches
 *      pressées, abstraction DX/OGL par exemple
 */

#ifndef USERINPUTSTATE_H_
#define USERINPUTSTATE_H_

#include "../Tools/Geometry/Vect4.h"
#include "../Tools/Misc/Singleton.h"

class UserInputState: public Singleton<UserInputState>{

	friend class Singleton<UserInputState>;

public:

	void keyPressed(char key){m_keyPressed += key;};

	void keyReleased(){m_keyPressed.clear();};

	void updateMouse(Vect4<bool> state);

	std::string getKey(){return m_keyPressed;}

	friend std::ostream& operator<<(std::ostream& out, const UserInputState& ent){
		ent.print(out);
		return out;
	}
	virtual void print(std::ostream& o) const {
		o << "UserInput:" << m_keyPressed << " (" << m_mouseButton << ")";
	}

private:

	UserInputState(){};
	virtual ~UserInputState(){};

	std::string m_keyPressed;
	Vect4<bool> m_mouseButton;
	int m_xMouse, m_yMouse;
};

#endif /* USERINPUTSTATE_H_ */
